<?php
date_default_timezone_set('PRC');

#header("Access-Control-Allow-Origin: *"); // 允许任意域名发起的跨域请求

//开始时间
list($t1, $t2) = explode(' ', microtime());
$stime = (float)sprintf('%.0f', (floatval($t1) + floatval($t2)) * 1000);
define('STIME', $stime);
define('PAGE_NUMBER', STIME . '-' . rand(10000000, 99999999) . '-' . rand(1000000, 9999999));


define('BASE_PATH', str_replace('\\', '/', realpath(__DIR__ . '/')) . "/");
define('BASE_URL', 'http://' . $_SERVER['SERVER_NAME'] . ($_SERVER["SERVER_PORT"] == 80 ? '' : ':' . $_SERVER["SERVER_PORT"]));

define('IS_DEV', strpos(BASE_URL, 'api.wechat.com') == false ? false : true);
define('IS_PRO', strpos(BASE_URL, 'scrm.ebanktest.com') == false ? false : true);

defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

if (YII_ENV === 'dev') {
    ini_set("display_errors", "On");
    error_reporting(E_ALL | E_STRICT);
}


require(__DIR__ . '/vendor/autoload.php');
require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php');
require(__DIR__ . '/common/config/bootstrap.php');

$config = require(__DIR__ . '/common/config/main.php');

require(__DIR__ . '/common/doc/doc.php');
require(__DIR__ . '/common/ai/ai.php');
require(__DIR__ . '/common/cm/cm.php');

$application = new yii\web\Application($config);

$application->run();